package cmd

import (
	"fmt"

	"gitee.com/eeppee_admin/go-tuiftp/internal/service/cp"
)

// CpOperation 复制文件操作,实现IOperation
type CpOperation struct {
}

func (c *CpOperation) Execute(args []string) error {
	if err := c.ArgsValidation(args); err != nil {
		return err
	}
	// cp src to dst
	return cp.Cp(args[0], args[1])
}

func (c *CpOperation) ArgsValidation(args []string) error {
	if len(args) < 2 {
		return fmt.Errorf("cp command need 2 args")
	}
	return nil
}
